package com.zdsoft.blp.zongbuju.shouye.linliquan.activity;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zdsoft.blp.R;
import com.zdsoft.blp.gongyong.linliFragment.LinLiView;
import com.zdsoft.blp.gongyong.net.BaseActivity;
import com.zdsoft.blp.zongbuju.shouye.linliquan.adapter.PCfragmentAdapter;
import com.zdsoft.blp.zongbuju.shouye.linliquan.fragment.PCfragmentLeft;
import com.zdsoft.blp.zongbuju.shouye.linliquan.fragment.PCfragmentRight;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/8/31.
 */
public class LLPinCheActivitv extends BaseActivity {
    private LinLiView llv;          //封装的viewPager+fragment
    private TextView tv_title;      //封装的标题
    private ImageView title_bianji;//编辑图片
    public int source;
    private Intent intent;
    @Override
    protected void init() {
        setContentView(R.layout.linli_pinchexinxi);
        llv = find(R.id.llv);
        //设置标题
        tv_title = find(R.id.tv_title);
        tv_title.setText("拼车");
        llv.getTv_left().setText("找乘客");
        llv.getTv_right().setText("找拼车");
        intent=getIntent();
        source=intent.getIntExtra("source",1);
        //图片跳转到编辑页面
        title_bianji = find(R.id.title_bianji);
        title_bianji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                intent = new Intent(LLPinCheActivitv.this,FBPCActivity.class);
                if(llv.isChack()){
                    intent.putExtra("title","找乘客");
                }else{
                    intent.putExtra("title","找拼车");
                }
                startActivity(intent);
            }
        });
        //加载fragment布局
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new PCfragmentLeft());
        fragments.add(new PCfragmentRight());
        llv.getVp().setAdapter(new PCfragmentAdapter(getSupportFragmentManager(),fragments));
    }

}
